'use strict'
exports.page = function(len,page,num){
	let count_page = len/num;
	count_page = (count_page.toString().split('.').length === 2)?parseInt(count_page.toString().split('.')[0])+1:count_page;
	let start,end;
	if (page <= 0){
		page = 1;
		start = 0;
		end = num;
		return {start:start,end:end}
	}
	else if (page >= count_page){
		page = count_page;
		start = (page-1) * num
		end = start + parseInt(num)
		return {start:start,end:end}
	}
	else if (page === 1){
		start = page -1;
		end = num
		return {start:start,end:end}
	}else {
		start = (page-1) * num
		end = start + parseInt(num)
		return {start:start,end:end}
	}
}